var mongoose = require('mongoose');

//问题表(problem)

var problemSchema = new mongoose.Schema({
    problemname: {
        type: String,
        required: true
    }, //问题标题
    content: {
        type: String,
    }, //问题说明内容
    userid: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'user_login',
        required: true
    }, //用户id
    adopt: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'answer'
    }, //采纳回答
    release_time: {
        type: Date,
        default: new Date
    }, //发布时间
    problemtype: {
        type: String,
        required: true
    }, //文章类型
    reading: {
        type: Number,
        default: 0
    }, //阅读量
    reply: {
        type: Number,
        default: 0
    }, //回复量
    audit: {
        type: Boolean,
        default: false
    }, //审核
    textReplace: {
        type: String
    }, //文章缩略
})

module.exports = mongoose.model('problem', problemSchema)